/* $Id: ServiceDomainObjectManager.java 
 * Copyright (C) 2011, TRAKHEES
 *  
 * Revision History
 *
 * Date  			Author 		    	Remarks
 * ---------------------------------------------------------------------------------
 *
 */
package ae.pcfc.etks.online.common.domain.manager;


import java.util.List;

import ae.pcfc.etks.online.common.domain.Client;
import ae.pcfc.etks.online.common.domain.ClientServiceRole;
import ae.pcfc.etks.online.common.domain.Service;
import ae.pcfc.etks.online.common.domain.ServiceReq;
import ae.pcfc.etks.online.common.domain.ServiceRole;
import ae.pcfc.etks.online.common.exception.LookupException;
import ae.pcfc.etks.online.common.exception.PersistenceException;
import ae.pcfc.etks.online.common.vo.PagingVO;

public interface ServiceDomainObjectManager extends BaseDomainObjectManager{
	
	/**
	 * add
	 * Method to add service
	 * @param services
	 * @return
	 * @throws PersistenceException
	 * boolean
	 */
	public boolean add(Service services)  throws PersistenceException;
	
	/**
	 * getServicesList
	 * Method to get all active services
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> getServicesList() throws LookupException;
	
	/**
	 * getServiceByPrimaryKey
	 * Method to find service by primary key
	 * @param Id
	 * @return
	 * @throws LookupException
	 * Service
	 */
	public Service getServiceByPrimaryKey(Long Id) throws LookupException;
	
	/**
	 * deleteServiceById
	 * Method to delete a service
	 * @param Id
	 * @return
	 * @throws PersistenceException
	 * boolean
	 */
	public boolean deleteServiceById(Long Id)throws PersistenceException;
	
	/**
	 * findServiceByServiceRoleIds
	 * Method to find the services by service role ids
	 * @param serviceRoleIds
	 * @param strDefault
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> findServiceByServiceRoleIds(List<Long> serviceRoleIds, String strDefault) throws LookupException;
	
	/**
	 * findServiceRoleByRoleIds
	 * Method to find services role domain objects by service role ids
	 * @param serviceRoleIds
	 * @return
	 * @throws LookupException
	 * List<ServiceRole>
	 */
	public List<ServiceRole> findServiceRoleByRoleIds(List<Long> serviceRoleIds) throws LookupException;
	
	/**
	 * findServiceAvailableByUserNameAndRoleIds
	 * Method to find service available for a user for registration
	 * @param userName
	 * @param roleIds
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> findServiceAvailableByUserNameAndRoleIds(String userName, List<Long> roleIds) throws LookupException;
	
	/**
	 * addServiceReq
	 * Method to add service request
	 * @param serviceReq
	 * @throws PersistenceException
	 * void
	 */
	public void addServiceReq(ServiceReq serviceReq) throws PersistenceException;
	
	/**
	 * findServiceListByIds
	 * Method to find the service list by service ids
	 * @param ids
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> findServiceListByIds(List<Long> ids) throws LookupException;
	
	/**
	 * findServiceReqByApplicationId
	 * Method to find the service registration requests by application id
	 * @param applicationId
	 * @return
	 * @throws LookupException
	 * List<ServiceReq>
	 */
	public List<ServiceReq> findServiceReqByApplicationId(String applicationId) throws LookupException;
	
	/**
	 * findServiceRoleByRoleId
	 * Method to find the service role domain objects by role id
	 * @param roleId
	 * @return
	 * @throws LookupException
	 * List<ServiceRole>
	 */
	public List<ServiceRole> findServiceRoleByRoleId(Long roleId) throws LookupException;
	
	/**
	 * addServiceRole
	 * Method to add service role
	 * @param serviceRole
	 * @throws PersistenceException
	 * void
	 */
	public void addServiceRole(ServiceRole serviceRole) throws PersistenceException;
	
	/**
	 * findServiceListByUserName
	 * Method to find services associated with a user (username)
	 * @param userName
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> findServiceListByUserName(String userName) throws LookupException;
	
	/**
	 * findUserDefaultService
	 * Method to find the user default service
	 * @return
	 * @throws LookupException
	 * Service
	 */
	public Service findUserDefaultService() throws LookupException;
	
	/**
	 * findServiceByServiceDefault
	 * Method to find default service by service default code
	 * @param strServiceDefault
	 * @return
	 * @throws LookupException
	 * Service
	 */
	public Service findServiceByServiceDefault(String strServiceDefault) throws LookupException;	
	
	/**
	 * findServiceReqByUserAndServiceId
	 * Method to find the service request domain object registered by user and service id
	 * @param userId
	 * @param serviceId
	 * @return
	 * @throws LookupException
	 * ServiceReq
	 */
	public ServiceReq findServiceReqByUserAndServiceId(Long userId, Long serviceId)throws LookupException;
	
	/**
	 * getServicesListByPagingVO
	 * Method to list of servce page based on the paging information
	 * @param pagingVO
	 * @return
	 * @throws LookupException
	 * List<Service>
	 */
	public List<Service> getServicesListByPagingVO(PagingVO pagingVO) throws LookupException;

	/**
	 * findServiceRolesByServiceType
	 * Method to find the service roles by service type (internal/external)
	 * @param serviceType
	 * @return
	 * List<ServiceRole>
	 */
	public List<ServiceRole> findServiceRolesByServiceType(String serviceType);

	/**
	 * findServiceRolesByUserName
	 * Method to find the service roles associated with a user (user id)
	 * @param strUserName
	 * @return
	 * List<ServiceRole>
	 */
	public List<ServiceRole> findServiceRolesByUserName(String strUserName);


	

	/**
	 * findServiceRoleByClientAndRoleId
	 * Method to find the service roles by Client and Role Id
	 * @param strUserName
	 * @param	roleId
	 * @return
	 * List<ServiceRole>
	 */
	public List<ClientServiceRole> findServiceRoleByClientAndRoleId(Client client, Long roleId);

	public List<ServiceRole> findAvailableServiceRoleByRoleIdForClient(Long roleId, Client client);
	
}
